home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
aapain1a
/
form1.frm
next >
Wrap
Text File
|
1998-10-10
|
7KB
|
231 lines
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00FFFFFF&
BorderStyle = 5 'Sizable ToolWindow
Caption = "Paint"
ClientHeight = 7050
ClientLeft = 165
ClientTop = 690
ClientWidth = 9210
FillStyle = 0 'Solid
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
MousePointer = 2 'Cross
ScaleHeight = 7050
ScaleWidth = 9210
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
Begin VB.Menu mnuPic
Caption = "&Picture"
Begin VB.Menu mnupicClear
Caption = "&Clear"
End
End
Begin VB.Menu mnuToolbar
Caption = "Toolbar"
Begin VB.Menu mnutbshow
Caption = "Show"
End
Begin VB.Menu mnutbhide
Caption = "Hide"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Paint v1.0
'Author: Dustin Davis
'Bootleg Software Inc.
'http://www.warpnet.org/bsi
'
'This is some simple code to draw pixels on the screen! There are diffrent
'brush settings, block - small, medium and large, also, star - small, med. and large
'This is mostly for anyone looking to do something like this. Kind of small and
'doesnt have very many features, but you can add them yourself!
'please do not steal this code! If you use it, please give proper credit
'enjoy!
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public pBrush As Integer 'for the brush type. 1-6
Public bColor As Long 'back color
Public pColor As Long 'brush color
Private Sub Form_DblClick()
'popup menu
Form1.PopupMenu mnuPic
End Sub
Private Sub Form_Load()
'standard place settings
Form1.Top = 0
Form1.Left = Screen.Width / 4
Form2.Visible = True
pColor = 0 'set brush color to black
bColor = Form1.BackColor 'set bcolor to proper color setting
pBrush = 1 'set brush size
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo errErrors
'this is what makes things go!
Dim i As Long
If Button = 1 Then 'if left button pushed
If pBrush = 1 Then
'small block brush
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), pColor
PSet (X + i, Y - i), pColor
PSet (X + i, Y + i), pColor
PSet (X, Y + i), pColor
PSet (X - i, Y), pColor
PSet (X - i, Y - i), pColor
PSet (X - i, Y + i), pColor
PSet (X, Y - i), pColor
i = i + 1
Loop Until i = 10
ElseIf pBrush = 2 Then
'medium block brush
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), pColor
PSet (X + i, Y - i), pColor
PSet (X + i, Y + i), pColor
PSet (X, Y + i), pColor
PSet (X - i, Y), pColor
PSet (X - i, Y - i), pColor
PSet (X - i, Y + i), pColor
PSet (X, Y - i), pColor
i = i + 1
Loop Until i = 25
ElseIf pBrush = 3 Then
'large block brush
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), pColor
PSet (X + i, Y - i), pColor
PSet (X + i, Y + i), pColor
PSet (X, Y + i), pColor
PSet (X - i, Y), pColor
PSet (X - i, Y - i), pColor
PSet (X - i, Y + i), pColor
PSet (X, Y - i), pColor
i = i + 1
Loop Until i = 40
ElseIf pBrush = 4 Then
'small star brush
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), pColor
PSet (X, Y + i), pColor
PSet (X - i, Y), pColor
PSet (X, Y - i), pColor
PSet (X + i, Y + i), pColor
PSet (X - i, Y - i), pColor
PSet (X + i + i, Y + i + i), pColor
PSet (X - i - i, Y - i - i), pColor
i = i + 1
Loop Until i = 10
ElseIf pBrush = 5 Then
'medium star brush
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), pColor
PSet (X, Y + i), pColor
PSet (X - i, Y), pColor
PSet (X, Y - i), pColor
PSet (X + i, Y + i), pColor
PSet (X - i, Y - i), pColor
PSet (X + i + i, Y + i + i), pColor
PSet (X - i - i, Y - i - i), pColor
i = i + 1
Loop Until i = 20
ElseIf pBrush = 6 Then
'large star brush
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), pColor
PSet (X, Y + i), pColor
PSet (X - i, Y), pColor
PSet (X, Y - i), pColor
PSet (X + i, Y + i), pColor
PSet (X - i, Y - i), pColor
PSet (X + i + i, Y + i + i), pColor
PSet (X - i - i, Y - i - i), pColor
i = i + 1
Loop Until i = 40
End If
ElseIf Button = 2 Then
'this is the eraser!
PSet (X, Y), pColor
i = 0
Do
DoEvents
PSet (X + i, Y), bColor
PSet (X + i, Y - i), bColor
PSet (X + i, Y + i), bColor
PSet (X, Y + i), bColor
PSet (X - i, Y), bColor
PSet (X - i, Y - i), bColor
PSet (X - i, Y + i), bColor
PSet (X, Y - i), bColor
i = i + 1
Loop Until i = 25
End If
errErrors:
If Err.Number = 28 Then 'stack overflow
MsgBox "Stack Over flow!" & vbCrLf & "Please reduce draw width size!", vbCritical, "Error"
Exit Sub
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
'make sure to turn the toolbar off or it will stay on
Unload Form2
End Sub
Private Sub mnuFileExit_Click()
'exit!
Unload Me
End Sub
Private Sub mnupicClear_Click()
'clear drawing area
Form1.Cls
End Sub
Private Sub mnutbhide_Click()
'hide toolbar
Form2.Visible = False
End Sub
Private Sub mnutbshow_Click()
'show toolbar and place it to its proper setting
Form2.Visible = True
Form2.Top = Form1.Top
Form2.Left = Form1.Left - Form2.Width
End Sub